<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<head>
    <th:block th:include="include :: header('施工资料审批')" />
    <link rel="stylesheet" href="../../../../../../../../../../../../css/navigation.css">
</head>
<body class="gray-bg">
<div class="navigation visible-xs-block">
    <ol class="breadcrumb">
        <span> > </span>
        <li><a href="#" onclick="gomain()">主页</a></li>
        <li style="color: black">施工资料审批</li>
    </ol>
    <div class="aLine"></div>
</div>
<div class="container-div">
    <div class="row">
        <div class="col-sm-12 search-collapse">
            <form id="formId">
                <div class="select-list">
                    <ul>
                        <li>
                            <label>项目名称：</label>
                            <input type="text" name="pName"/>
                        </li>
<!--                        <li>-->
<!--                            <label>资料类型：</label>-->
<!--                            <select name="imType" th:with="type=${@dict.getType('')}">-->
<!--                                <option value="">所有</option>-->
<!--                                <option th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>-->
<!--                            </select>-->
<!--                        </li>-->
<!--                        <li>-->
<!--                            <label>资料名称：</label>-->
<!--                            <input type="text" name="imName"/>-->
<!--                        </li>-->
<!--                        <li>-->
<!--                            <label>上传资料：</label>-->
<!--                            <input type="text" name="imData"/>-->
<!--                        </li>-->
<!--                        <li class="select-time">-->
<!--                            <label>上传时间：</label>-->
<!--                            <input type="text" class="time-input" id="startTime" placeholder="开始时间" name="params[beginImTime]"/>-->
<!--                            <span>-</span>-->
<!--                            <input type="text" class="time-input" id="endTime" placeholder="结束时间" name="params[endImTime]"/>-->
<!--                        </li>-->
<!--                        <li>-->
<!--                            <label>上传人：</label>-->
<!--                            <input type="text" name="imTheHeir"/>-->
<!--                        </li>-->
<!--                        <li>-->
<!--                            <label>备注：</label>-->
<!--                            <input type="text" name="imRemark"/>-->
<!--                        </li>-->
<!--                        <li>-->
<!--                            <label>项目信息：</label>-->
<!--                            <input type="text" name="imPro"/>-->
<!--                        </li>-->
                        <li>
                            <a class="btn btn-primary btn-rounded btn-sm" onclick="$.table.search()"><i class="fa fa-search"></i>&nbsp;搜索</a>
                            <a class="btn btn-warning btn-rounded btn-sm" onclick="$.form.reset()"><i class="fa fa-refresh"></i>&nbsp;重置</a>
                        </li>
                    </ul>
                </div>
            </form>
        </div>

        <div class="col-sm-12 select-table table-bordered">
            <table id="bootstrap-table"></table>
        </div>
    </div>
</div>
<th:block th:include="include :: footer" />
<script src="../../../../../../../../../../../../js/breadcrumb.js"></script>
<script th:inline="javascript">
    var editFlag = [[${@permission.hasPermi('ruoyi:verifyedit:edit')}]];
    var removeFlag = [[${@permission.hasPermi('ruoyi:impl:remove')}]];
    var creadFlag = [[${@permission.hasPermi('ruoyi:completed:add')}]];
    //工程文件字典类型
    var beType = [[${@dict.getType('sys_be_type')}]];
    //审批状态字典
    var imState = [[${@dict.getType('impl_approval')}]];
    var prefix = ctx + "system/building";
    var prefixs = ctx + "ruoyi/implVerify";

    $(function() {
        var options = {
            url: prefix + "/list",
            createUrl: prefixs + "/add/{id}",
            exportUrl: prefix + "/export",
            removeUrl: prefixs + "/remove",
            updateUrl: prefixs + "/edit/{id}",
            modalName:"施工资料审批列表",
            showColumns: false,
            detailView: true,
            mobileResponsive: false,
            cardView: true,
            sortName: 'pTime',
            sortOrder: 'desc',
            onExpandRow: function (index, row, $building) {
                initChildTable(index, row, $building);
            },
            rowStyle:{
                css:{"height":"50px"}
            },
            columns: [
                {
                    field: 'pId',
                    title: '项目id',
                    visible: false
                },
                {
                    field: 'pName',
                    title: '项目名称'
                },
                {
                    field: 'pTime',
                    title: '项目日期',
                    sortable: true,
                },
                {
                    field: 'pFounder',
                    title: '项目经理'
                },
            ]
        };
        $.table.init(options);
    });

    initChildTable = function (index, row, $building) {
        var childTable = $building.html('<table style="table-layout:fixed"></table>').find('table');
        $(childTable).bootstrapTable({
            url: prefixs  + "/lists",
            method: 'post',
            striped: true,
            sidePagination: "server",
            contentType: "application/x-www-form-urlencoded",

            queryParams: {
                sid:row.pId
            },
            columns: [
                {
                    field: 'imId',
                    title: '资料id',
                    visible: false
                },
                {
                    field: 'imType',
                    title: '资料类型',
                    width: 100,
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(beType, value);
                    }
                },
                {
                    field: 'imName',
                    title: '资料名称',
                    width: 100,
                },
                {
                    field: 'imData',
                    title: '资料下载',
                    align: 'center',
                    width: 100,
                    formatter: function(value, row, index) {
                        return '<a href="javascript:downloadFile(\''+row.imData+'\')">下载</a>';
                    }
                },
                {
                    field: 'imTime',
                    title: '上传时间',
                    width: 100,
                },
                {
                    field: 'imTheHeir',
                    title: '上传人',
                    width: 100,
                },
                {
                    field: 'imRemark',
                    title: '备注',
                    width: 100,
                },
                {
                    field: 'imPro',
                    title: '项目信息',
                    visible: false

                },
                {
                    field: 'imState',
                    title: '审批状态',
                    width: 100,
                    align: 'center',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(imState, value);
                    }
                },
                {
                    field: 'imOpinion',
                    title: '审批意见',
                    width: 100,
                },
                {
                    title: '操作',
                    width: 100,
                    align: 'center',
                    formatter: function (value, row, index) {
                        var actions = [];
                        if (row.imState==1){
                            actions.push('<a class="btn btn-info btn-xs" href="javascript:void(0)" onclick="consent(\'' + row.imId + '\')"><i class="fa fa-user"></i> 通过</a> ');
                            actions.push('<a class="btn btn-warning btn-xs ' + editFlag + '" href="javascript:void(0)" onclick="$.operate.edit(\'' + row.imId + '\')"><i class="fa fa-edit"></i>驳回</a> ');

                        }
                        return actions.join('');
                    }
                }

            ]
        });
    };
    function downloadFile(pUploading) {
        window.location.href=ctx+"common/download/resource?resource="+pUploading;
    }
    function consent(imId) {

        $.modal.confirm("确认要通过申请吗?", function() {
            var url = prefixs + "/consent";
            var data = { "imId": imId };
            $.operate.submit(url, "post", "json", data);
        });
    }
</script>
</body>
</html>